package com.example.myapplicationwork.model;

/**
 * 用户响应模型
 * 用于解析服务器返回的用户信息
 */
public class UserResponse {
    private User data;
    private Support support;
    private String error;

    public UserResponse() {
    }

    public User getData() {
        return data;
    }

    public void setData(User data) {
        this.data = data;
    }

    public Support getSupport() {
        return support;
    }

    public void setSupport(Support support) {
        this.support = support;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    /**
     * 判断响应是否成功
     */
    public boolean isSuccess() {
        // 同时检查data是否存在且error字段不存在
        return data != null && error == null;
    }

    /**
     * 支持信息内部类
     */
    public static class Support {
        private String url;
        private String text;

        public Support() {
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }

        public String getText() {
            return text;
        }

        public void setText(String text) {
            this.text = text;
        }
    }
}